﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace GBSHouse.UptimeRobot {
	public class UptimeRobotMonitorResponse {

		/// <summary>
		/// Gets or sets the status.
		/// </summary>
		/// <value>
		/// The status.
		/// </value>
		[JsonProperty("stat")]
		public string Status { get; set; }

		/// <summary>
		/// Gets or sets the monitor.
		/// </summary>
		/// <value>
		/// The monitor.
		/// </value>
		[JsonProperty("monitor")]
		public UptimeRobotMonitorResponseMonitor Monitor { get; set; }

		/// <summary>
		/// Gets a value indicating whether this <see cref="UptimeRobotMonitorResponse"/> is success.
		/// </summary>
		/// <value>
		///   <c>true</c> if success; otherwise, <c>false</c>.
		/// </value>
		[JsonIgnore]
		public bool Success {
			get { return this.Status.Equals("ok", StringComparison.InvariantCultureIgnoreCase); }
		}

		/// <summary>
		/// Gets or sets the monitor ID.
		/// </summary>
		/// <value>
		/// The monitor ID.
		/// </value>
		[JsonIgnore]
		public int MonitorID {
			get { return this.Monitor.ID; }
			set { this.Monitor.ID = value; }
		}

		public UptimeRobotMonitorResponse() {
			this.Monitor = new UptimeRobotMonitorResponseMonitor();
		}

		public class UptimeRobotMonitorResponseMonitor {

			/// <summary>
			/// Gets or sets the ID.
			/// </summary>
			/// <value>
			/// The ID.
			/// </value>
			[JsonProperty("id")]
			public int ID { get; set; }

		}
	}
}
